package de.lulusoft.anothertorrent.gui.views.Providers;

import org.eclipse.jface.viewers.ILabelProviderListener;
import org.eclipse.jface.viewers.ITableLabelProvider;
import org.eclipse.swt.graphics.Image;

import de.lulusoft.anothertorrent.core.rtorrent.File;
import de.lulusoft.anothertorrent.gui.util.Util;

public class FilesTableLabelProvider implements ITableLabelProvider {

	@Override
	public Image getColumnImage(Object element, int columnIndex) {
		return null;
	}

	@Override
	public String getColumnText(Object element, int columnIndex) {
		if (element instanceof File)
		{
			File f = (File)element;
			switch (columnIndex)
			{
			case 0: return f.getPath();
			case 1: return Util.formatBytes(f.getSize_bytes());
			case 2: return f.getDonePercent().toString() + " %";
			case 3: return f.getCompleted_chunks() + " / " + f.getSize_chunks();
			case 4:
				if (f.getPriority().equals(0L)) return "Off";
				if (f.getPriority().equals(1L)) return "Normal";
				if (f.getPriority().equals(2L)) return "High";
				break;
			
			default: return "Not yet implemented";
			}
		}
		return "";
	}

	@Override
	public void addListener(ILabelProviderListener listener) {
	}

	@Override
	public void dispose() {
	}

	@Override
	public boolean isLabelProperty(Object element, String property) {
		return false;
	}

	@Override
	public void removeListener(ILabelProviderListener listener) {
	}

}
